// Programming_Scala/src/ch13/http-enum3-script.scala

object HttpMethod extends Enumeration( "Connect", "Delete", "Get", "Head", "Options", "Post", "Put", "Trace" ) {
  type Method = Value
  val Connect, Delete, Get, Head, Options, Post, Put, Trace = Value
}

import HttpMethod._

def doPrintln( method: HttpMethod.Method ): Unit = {
  println( method + ": " + method.id )
}

def handle( method: HttpMethod.Method ) = method match {
  case Connect => doPrintln( method )
  case Delete => doPrintln( method )
  case Get => doPrintln( method )
  case Head => doPrintln( method )
  case Options => doPrintln( method )
  case Post => doPrintln( method )
  case Put => doPrintln( method )
  case Trace => doPrintln( method )
}

// HttpMethod foreach { method => handle( method ) }
HttpMethod foreach { yam => handle( yam ) }
println( HttpMethod )
